load("//test_utils.bzl", "assert_output")

# buildifier: disable=no-effect
export_file(
    name = "al__.mli",
    visibility = [
        ":al__",
        ":al__imp",
    ],
) if not host_info().os.is_windows else None

# buildifier: disable=no-effect
ocaml_library(
    name = "al__",
    srcs = [
        "al__.ml",
        ":al__.mli",
    ],
    compiler_flags = ["-no-alias-deps"],
    visibility = [":al__imp"],
) if not host_info().os.is_windows else None

# buildifier: disable=no-effect
ocaml_library(
    name = "al__imp",
    srcs = glob(
        ["al__*.ml*"],
        exclude = ["al__.ml*"],
    ),
    compiler_flags = [
        "-open",
        "Al__",
    ],
    ocamldep_flags = [
        "-open",
        "Al__",
        "-map",
        "$(location :al__.mli)",
    ],
    visibility = [":al"],
    deps = [":al__"],
) if not host_info().os.is_windows else None

# buildifier: disable=no-effect
ocaml_library(
    name = "al",
    srcs = glob(["al.ml*"]),
    compiler_flags = [
        "-open",
        "Al__",
    ],
    visibility = ["PUBLIC"],
    deps = [":al__imp"],
) if not host_info().os.is_windows else None

# buildifier: disable=no-effect
ocaml_binary(
    name = "test-Al",
    srcs = ["test_Al.ml"],
    visibility = ["PUBLIC"],
    deps = [":al"],
) if not host_info().os.is_windows else None

# buildifier: disable=no-effect
assert_output(
    name = "test-Al-check",
    command = "$(exe_target :test-Al)",
    output = "Hello world!",
) if not host_info().os.is_windows else None
